<html>

<head>
<meta charset="UTF-8">
<title>通知列表</title>
</head>
<body>
	<#import "/page.ftl" as page />
	<link rel="stylesheet" type="text/css" href="/css/form.css">
	<script src="/js/announce.js"></script>
	<#include "/head.ftl"/>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<!-- <a href="/announce/form" title="发布通知" class="btn btn-setting btn-add" id="add"> <i class="iconfont icon-add"
					style="font-size: 16px;"></i>
				</a> -->
				<a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a>
				<form class="tab-tool" method="get" id="search">
					<input name="key" type="text" placeholder="按关键字查找...">
					<button class="search-btn">
						<i class="iconfont icon-search"></i>
					</button>
				</form>
			</div>
			<div class="tab-content">
				<div>
					<table style="width: 100%; border-collapse: collapse;">
						<tr>
							<#assign sort=announces.sort?replace(': ',',') />
							<th>类型</th>
							<th>标题</th>
							<th>状态
								<#if sort=='announce.status,DESC'>
									<a onclick="pageSort('${requestURI}','announce.status')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='announce.status,ASC' >
									<a onclick="pageSort('${requestURI}','announce.status,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','announce.status')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>发布时间
								<#if sort=='announce.time,DESC'>
									<a onclick="pageSort('${requestURI}','announce.time')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='announce.time,ASC' >
									<a onclick="pageSort('${requestURI}','announce.time,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','announce.time')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>发布人</th>
							<th>操作</th>
						</tr>
						<#list ann as ann>
							<tr data-id="${ann.id}">
								<td>
									<#list types['announce'] as ta>
										<#if ta.value==ann.type><span class="label" style="color: ${ta.color}">[${ta.name}]</span></#if>
									</#list>
								</td>
								<td>${ann.title}</td>
								<td>
									<#list status['announce'] as sa>
										<#if sa.value==ann.status><span class="label" style="background-color: ${sa.color}">${sa.name}</span></#if>
									</#list>
								</td>
								<td>${ann.time}</td>
								<td>${ann.user.realName}</td>
								<td>
									<a onclick="showAnnounce(this)" title="查看详情" class="btn btn-look"><i class="iconfont icon-search"></i><span> 查看详情</span></a>
									<div style="padding:10px;display: none;">
										<h2 style="margin:10px 0px;">${ann.title}</h2>
										<span style="color:#999;font-size:12px;">${ann.user.realName} 于 ${ann.time} 发布</span>
										<hr>
										<p style="margin:10px 0px;">${ann.content}</p>
									</div>
								</td>
							</tr>
						</#list>
						<#if announces.content?size gt 0>
							<#list (announces.content) as announce>
								<!-- 除去公告 -->
								<#if announce.announce.type!=0>
									<#if announce.auIsRead==0 >
										<tr style="font-weight: bolder;">
									<#else>
										<tr data-id="${announce.announce.id}">
									</#if>
										<td>
											<#list types['announce'] as ta>
												<#if ta.value==announce.announce.type><span class="label" style="color: ${ta.color}">[${ta.name}]</span></#if>
											</#list>
										</td>
										<td>${announce.announce.title}</td>
										<td>
											<#list status['announce'] as sa>
												<#if sa.value==announce.announce.status><span class="label" style="background-color: ${sa.color}">${sa.name}</span></#if>
											</#list>
										</td>
										<td>${announce.announce.time}</td>
										<td>${announce.announce.user.realName}</td>
										<td>
											<a onclick="showAnnounce(this)" title="查看详情" class="btn btn-look"><i class="iconfont icon-search"></i><span> 查看详情</span></a>
											<div data-id="${announce.auId}" style="display: none;">
												<h2 style="margin:10px 0px;">${announce.announce.title}</h2>
												<span style="color:#999;font-size:12px;">${announce.announce.user.realName} 于 ${announce.announce.time} 发布</span>
												<hr>
												<p style="margin:10px 0px;">${announce.announce.content}</p>
											</div>
											<#if announce.announce.type==2>
												<a onclick="deleteOne(${announce.announce.id},'/announce/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span> 删除</span></a>
											</#if>
										</td>
									</tr>
								</#if>
							</#list>
						<#else>
							<tr><td colspan="6">暂时没有其他新消息~ </tr>
						</#if>
					</table>
				</div>
			</div>
			<@page.page url=requestURI pager=announces/>
		</div>
	</div>
</body>
</html>